<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<title>图书纠错中心</title>

<%@include file="/WEB-INF/views/commons/common.jsp" %>

<link rel="stylesheet" type="text/css" href="${base_href}/static/ui-frame/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="${base_href}/static/ui-frame/jquery-easyui/1.4.3/themes/metro/easyui.css">
<link rel="stylesheet" type="text/css" href="${base_href}/static/ui-frame/bootstrap-dialog3/css/bootstrap-dialog.css">
<link rel="stylesheet" type="text/css" href="${base_href}/static/ui-frame/validation-engine/validationEngine.jquery.css">
<link rel="stylesheet" type="text/css" href="${base_href}/static/css/search-theme.css">

</head>
<body  data-grid="easyui">
	<div class="path"><span class="right-index">&gt;</span>  现在的位置：图书纠错中心</div>
<div class="tab-content">
	<div class="fold_ex">
		<h2 class="title-h2">
			<a href="javascript:void(0);" class="hide-next-btn">收起</a>
		</h2>
		
		<div>
		<form action="#">
			<table class="search-table container">
				<tr>
					<td class="text-right col-xs-2">问题详情</td>
					<td class="col-xs-4">
						<input type="text" class="form-control" name="question" value="" />
					</td>
					<td class="text-right col-xs-2">问题状态</td>
					<td class="col-xs-4">
						<select name="quesType" class="form-control">
							<option value="" selected="selected">请选择</option>
							 <c:forEach items="${quesTypes}" var="state">
								<option value="${state.code}">${state.value}</option>
							</c:forEach> 
						</select>
					</td>
				</tr>
				<tr>
					<td class="text-right col-xs-2 ">考试类别</td>
					<td class="col-xs-4">
						<select name="bookClass" class="form-control">
							<option value="">请选择</option>
							<c:forEach items="${quesBookClasses}" var="state">
								<option value="${state.code}" <c:if test="${state.code eq form.bookClass}">selected="selected"</c:if>>${state.value}</option>
							</c:forEach> 
						</select>
					</td>
					<td class="text-right col-xs-2 ">图书名称</td>
					<td class="col-xs-4">
						<select name="bookSecClass" class="form-control">
							<option value="" selected="selected">请选择</option>
							<c:if test="${form.bookClass eq '1'}">
								<c:forEach items="${quesBookClasses1}" var="dic">
								<option value="${dic.code}" <c:if test="${dic.code eq form.bookSecClass}">selected="selected"</c:if>>${dic.value}</option>
							</c:forEach> 
							</c:if>
							<c:if test="${form.bookClass eq '2'}">
								<c:forEach items="${quesBookClasses2}" var="dic">
								<option value="${dic.code}" <c:if test="${dic.code eq form.bookSecClass}">selected="selected"</c:if>>${dic.value}</option>
							</c:forEach> 
							</c:if>
							<c:if test="${form.bookClass eq '3'}">
								<c:forEach items="${quesBookClasses3}" var="dic">
								<option value="${dic.code}" <c:if test="${dic.code eq form.bookSecClass}">selected="selected"</c:if>>${dic.value}</option>
							</c:forEach> 
							</c:if>
							<c:if test="${form.bookClass eq '4'}">
								<c:forEach items="${quesBookClasses4}" var="dic">
								<option value="${dic.code}" <c:if test="${dic.code eq form.bookSecClass}">selected="selected"</c:if>>${dic.value}</option>
							</c:forEach> 
							</c:if>
						</select>
					</td>
				</tr>
				<tr>
					<td class="text-right col-xs-2">图书页码</td>
					<td class="col-xs-4">
						<input type="text" class="form-control" name="pageNum" value="" />
					</td>
					
					<td class="text-right col-xs-2">是否奖励</td>
					<td class="col-xs-4">
						<select name="isReward" class="form-control">
							<option value="">请选择</option>
							<option value="0">否</option>
							<option value="1">是</option>
						</select>
					</td>
				</tr>
				
			
				<tr>
					<td class="text-right col-xs-2"></td>
					<td class="text-right">
						<button type="button" class="btn search-btn" data-method="search"><i class="fa fa-search"></i>&nbsp;查询&nbsp;</button>
						<button type="button" class="btn search-btn" data-method="clear"><i class="fa fa-trash"></i>&nbsp;清空&nbsp;</button>
					</td>
				</tr>
			</table>
		</form>
		</div>

		<hr class="search-line"/>
		<table class="easyui-datagrid" >
			<thead>
				<tr>
					<th data-options="field:'id',checkbox:true">选择</th>
					<th data-options="field:'bookSecClassName',width:100,align:'center'">图书名称</th>
					<th data-options="field:'pageNum',width:20,align:'center'">图书页码</th>
					<th data-options="field:'quesDescribe',width:200,align:'center'">纠错描述</th>
					<th data-options="field:'quesTime',width:50,align:'center'">提问时间</th>
					<th data-options="field:'quesTypeValue',width:30,align:'center'">问题状态</th>
				</tr>
			</thead>
		</table>
	</div>
</div>

<script type="text/javascript" src="${base_href}/static/ui-frame/jquery/1.11.3/jquery.js"></script>


<script type="text/javascript" src="${base_href}/static/ui-frame/iframe-auto-height/jquery.autoheight.js"></script>
<script type="text/javascript" src="${base_href}/static/ui-frame/bootstrap/3.3.5/js/bootstrap.js"></script>
<script type="text/javascript" src="${base_href}/static/ui-frame/bootstrap-dialog3/js/bootstrap-dialog.js"></script>
<script type="text/javascript" src="${base_href}/static/ui-frame/jquery-easyui/1.4.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${base_href}/static/ui-frame/jquery-easyui/1.4.3/easyui.util.js"></script>
<script type="text/javascript" src="${base_href}/static/ui-frame/validation-engine/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="${base_href}/static/ui-frame/validation-engine/jquery.validationEngine.js"></script>
<script type="text/javascript" src="${base_href}/static/ui-frame/My97DatePicker/WdatePicker.js"></script>

<script type="text/javascript" src="${base_href}/static/ui-frame/requirejs/2.2.0/require.js"></script>

<script type="text/javascript">
requirejs.config({
    baseUrl: '<c:url value="/static/"/>',
    paths: {
        Grid: 'component/grid/js/ms-grid',
    },
    config: {
    	'Grid': { contextPath: '<c:url value="/"/>' },
    }
});


require(['Grid'], function(Grid) {
	
	Grid.columns({
		quesDescribe: {
			formatter: function(value, row, index) {
				var v = value == null ? "" : $('<div/>').text(value).html();
				return "<a href='javaScript:void(0);' onclick=\"grid.quesDescribe(event, " + index + ")\" class='grid-button' plain='true' title='"+ v +"'><div>" +  v + "</div></a>";
			},
			event: function(event, index) {
				var row = this.grid.datagrid('getRows')[index];
				var param = {quesId: row.quesId};
				
				var url = basePath + "/adminQuesList/openReadPage.html?" + $.param(param);
				var screenLocation = "width=960px,height=960,top=0,left=0,menubar=yes,resizable=yes,scrollbars =yes";
				this.windowOpen(url, "详细信息",screenLocation); //打开题目只读页面
				event.stopPropagation();
			}
		}
	});
	Grid.methods({
		checkLog:function(){
			var _checked = this.grid.datagrid('getChecked');
			if (_checked.length == 1) {
				var param = {quesId: _checked[0].quesId};
				var url = basePath + "/questionLog/quesLogPage.html?" + $.param(param);
				var screenLocation = "width=960px,height=960,top=0,left=0,menubar=yes,resizable=yes,scrollbars =yes";
				this.windowOpen(url, "详细信息",screenLocation);
			}else{
				BootstrapDialog.alert("请选择一条题目信息!");
			}
		}
		
	})
	
	$(function() {
		window.grid = Grid.events();
		var quesBookClasses1 ;
		var quesBookClasses2 ;
		var quesBookClasses3 ;
		var quesBookClasses4 ;
		$.ajax({
			url:  basePath+"/quesCollection/getDicsByParam.json?model=ques_book_class_1",
			type: "get",
			async: false, //不可异步,必须同步
			dataType:"json",
			success: function(r){
				quesBookClasses1 = r;
				}
		})
		$.ajax({
			url:  basePath+"/quesCollection/getDicsByParam.json?model=ques_book_class_2",
			type: "get",
			async: false, //不可异步,必须同步
			dataType:"json",
			success: function(r){
				quesBookClasses2 = r;
				}
		})
		$.ajax({
			url:  basePath+"/quesCollection/getDicsByParam.json?model=ques_book_class_3",
			type: "get",
			async: false, //不可异步,必须同步
			dataType:"json",
			success: function(r){
				quesBookClasses3 = r;
				}
		})
		$.ajax({
			url:  basePath+"/quesCollection/getDicsByParam.json?model=ques_book_class_4",
			type: "get",
			async: false, //不可异步,必须同步
			dataType:"json",
			success: function(r){
				quesBookClasses4 = r;
				}
		})
		
		$("select[name='bookClass']").change(function(){
			var checkText=$(this).find("option:selected").text();
			var checkValue=$(this).val();
			if(checkValue == undefined || checkValue == null || checkValue ==""){
				$("select[name='bookSecClass']").empty();
				$("select[name='bookSecClass']").find("option").remove();
				return;
			}
			if(checkValue == 1){
				$("select[name='bookSecClass']").empty();
				$("select[name='bookSecClass']").find("option").remove();
				
				$("select[name='bookSecClass']").append('<option value="" selected="selected">请选择</option>')
				for(var k = 0;k < quesBookClasses1.length;k++){
					var option = "<option value='"+quesBookClasses1[k].code+"'>"+quesBookClasses1[k].value+"</option>";
					$("select[name='bookSecClass']").append(option);
				}
			}
			if(checkValue == 2){
				$("select[name='bookSecClass']").empty();
				$("select[name='bookSecClass']").find("option").remove();
				
				$("select[name='bookSecClass']").append('<option value="" selected="selected">请选择</option>')
				for(var k = 0;k < quesBookClasses2.length;k++){
					var option = "<option value='"+quesBookClasses2[k].code+"'>"+quesBookClasses2[k].value+"</option>";
					$("select[name='bookSecClass']").append(option);
				}
			}
			if(checkValue == 3){
				$("select[name='bookSecClass']").empty();
				$("select[name='bookSecClass']").find("option").remove();
				
				$("select[name='bookSecClass']").append('<option value="" selected="selected">请选择</option>')
				for(var k = 0;k < quesBookClasses3.length;k++){
					var option = "<option value='"+quesBookClasses3[k].code+"'>"+quesBookClasses3[k].value+"</option>";
					$("select[name='bookSecClass']").append(option);
				}
			}
			if(checkValue == 4){
				$("select[name='bookSecClass']").empty();
				$("select[name='bookSecClass']").find("option").remove();
				
				$("select[name='bookSecClass']").append('<option value="" selected="selected">请选择</option>')
				for(var k = 0;k < quesBookClasses4.length;k++){
					var option = "<option value='"+quesBookClasses4[k].code+"'>"+quesBookClasses4[k].value+"</option>";
					$("select[name='bookSecClass']").append(option);
				}
			}
		});
	})
}) 
</script>

</body>
</html>
